Clean up circular variable support in rtsdiff#198
Open
pavelkomarov wants to merge 3 commits intomasterfrom
Open
Clean up circular variable support in rtsdiff#198pavelkomarov wants to merge 3 commits intomasterfrom
pavelkomarov wants to merge 3 commits intomasterfrom
Conversation
Replaces the per-dimension circular_vars/circular_units approach with a generic innovation_fn parameter on kalman_filter and a simple circular=False boolean on rtsdiff. Adds wrap_angle (radians-only) to utility.py and a test for wrapping angle differentiation. Addresses #178. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
25739d7 to
1260e10
Compare
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Builds on Floris' circular variable work to refine the design:
circular_vars/circular_unitsparameters onkalman_filterandrtsdiffwith a cleaner abstraction:kalman_filtergainsinnovation_fn=None: an optional callable(y_n, pred)that replaces the standardy[n] - C @ xhat_subtraction, making the filter fully generic for non-Euclidean measurements without any angle-specific logic inside the filter itselfrtsdiffgainscircular=False: whenTrue, the appropriate wrapping lambda is constructed internally and passed to both forward and backward filter calls(y - pred + π) % 2π - π) is inlined directly in the lambda rather than wrapped in a named utility function — it's a one-liner and clear in placenp.deg2radfirst (documented in the docstring)ensure_iterablefromutility.py, which is no longer neededtest_circular_rtsdiff: differentiates a noisy linearly-increasing angle that wraps across ±π boundaries and checks the recovered angular rate is within 0.5 rad/s RMSE of the truth (actual ≈ 0.04 rad/s)Addresses #178
Test plan
test_circular_rtsdiffpasses🤖 Generated with Claude Code